package com.woniuxy.controller;

import com.woniuxy.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/form")
public class MyFirstController {
    private List list;

    @RequestMapping("/getName")
    public ModelAndView getAll(String name){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg","接收到的前端参数是："+name);
        modelAndView.setViewName("index");
        return modelAndView;
    }
    @RequestMapping("/getList")
    public ModelAndView getAll(@RequestParam List ids){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg","接收到的前端参数是："+ids);
        modelAndView.setViewName("index");
        return modelAndView;
    }
    @RequestMapping("/getIds")
    public ModelAndView getAll(String[] ids){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg","接收到的前端参数是："+ Arrays.toString(ids));
        modelAndView.setViewName("index");
        return modelAndView;
    }
    @RequestMapping("/getUser")
    public ModelAndView getAll(User user){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg","接收到的前端参数是："+user);
        modelAndView.setViewName("index");
        return modelAndView;
    }
    @RequestMapping("/getMap")
    public ModelAndView getAll(@RequestParam Map map){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg","接收到的前端参数是："+map);
        modelAndView.setViewName("index");
        return modelAndView;
    }
}
